/**
    package: learn-go
    filename: _struct
    author: diogo@gmail.com
    time: 2021/10/9 13:50
**/
package main

import (
	"fmt"
	"reflect"
)

type User struct {
	Name   string "user name" //这引号里面的就是tag
	Passwd string "user passsword"
}

func main() {
	user := &User{"chronos", "pass"}
	s := reflect.TypeOf(user).Elem() //通过反射获取type定义
	for i := 0; i < s.NumField(); i++ {
		fmt.Println(s.Field(i).Tag) //将tag输出出来
	}
}
